package com.shihc.spring.transaction;

import com.shihc.spring.transaction.dao.UserDao;
import com.shihc.spring.transaction.model.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

/**
 * Created by shihc on 2015/6/15.
 */
@SpringBootApplication
public class Application implements CommandLineRunner {

    @Autowired
    private UserDao userDao;

    public static void main(String[] args){
        SpringApplication.run(Application.class);
    }

    @Override
    public void run(String... args) throws Exception {
        User user1 = new User();
        user1.setName("test1");
        user1.setEmail("test1@qq.com");

        User user2 = new User();
        user2.setName("test2");
        user2.setEmail("test2@qq.com");

        User user3 = new User();
        user3.setName("test3");
        user3.setEmail("test3@qq.com");

        userDao.save(user1);
        userDao.save(user2);
        userDao.save(user3);
    }
}
